package demo.java;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ExtendDemo {

    private static Logger logger = LoggerFactory.getLogger(JavaDemo.class);

    @Test
    public void testNull() {
        Long l = null;
        logger.info(String.valueOf(l));
        String a = l.toString();
        logger.info(a);
    }

    static void test() {
        // Son son = new Son();
        System.out.println("hello.");
        C c = new C();
        c.pX();
    }

    public void testOverload() {
        ExtendDemo t = new ExtendDemo();
        t.myMethod(null);
    }

    public void myMethod(Object o) {
        System.out.println("My Object");
    }

    public void myMethod(String s) {
        System.out.println("My String");
    }

    public static void testAdd() {
        // byte b = 2, e = 3;
        // byte f = b + e;
        // System.out.println(f);
    }

    public static void testASCII() {
        for (byte i = 0; i < Byte.MAX_VALUE; i++) {
            System.out.println(i + " = " + Character.toString((char) i));
        }
    }

}

// ---------------------------------------------------------

class Father {
    public Father() {
        System.out.println("father.");
    }
}

class Son extends Father {
    public Son() {
        System.out.println("son.");
    }
}

interface A {
    int x = 0;
}

class B {
    int x = 1;
}

class C extends B implements A {
    public void pX() {
        // System.out.println(x);//The field x is ambiguous
        System.out.println(super.x);
        // A.x = 3;// The final field A.x cannot be assigned
        System.out.println(A.x);

    }
}